﻿#pragma once
#include <string>
#include <vector>
#include <Psapi.h>
#include <codecvt>

#define VBOXWDDM_DEFAULT_REFRESH_RATE 60
#define VBOXWDDM_DECODER_REFRESH_RATE 120

const char SVGA_ADAPTER_DLL[] = "C:\\ProgramData\\display\\svga_adapter.dll";
const char SVGA_ADAPTER_X64_DLL[] = "C:\\ProgramData\\display\\svga_adapter_x64.dll";

const std::vector<std::wstring> dx10AppList = {
    L"直播伴侣.exe",
    L"creative cloud.exe",
    L"illustrator.exe",
    L"CEPHtmlEngine.exe",
    L"Skype.exe",
    L"Doubao.exe"
};

const std::vector<std::wstring> hookAppList = {
    L"Photos.exe",
    L"PhotosApp.exe"
};

const std::vector<std::wstring> softRenderingAppList = {
    L"Maps.exe",
    L"WinStore.App.exe",
    L"YoukuNplayer.exe",
    L"DataCenter.exe",
    L"javaw.exe",
    L"mstsc.exe",
    L"QuarkCloudDrive.exe",
    L"quark.exe",
    L"jsjbweb.exe",
    L"12345Setup.exe",
    L"cloudmusic.exe",
    L"FlutterPlugins.exe"
};

const std::vector<std::wstring> win32AppList = {
    L"EasiNote.exe",
    L"EasiNote.MediaHttpService.exe",
    L"EasiNote.Mirror.exe",
    L"EasiNote.Apphost.exe",
    L"EasiNote.RemoteProcess.exe",
    L"EasiNote.OfficeDocumentConverter.exe",
    L"wpp.exe",
    L"douyin.exe",
    L"BaiduNetdisk.exe",
    L"BaiduNetdiskRender.exe",
    L"baidunetdiskhost.exe",
    L"BaiduNetdiskUnite.exe",
    L"Xmp.exe",
    L"APlayer.exe",
    L"SHPlayer.exe",
    L"War3.exe"
};

const std::vector<std::wstring> AllowDxva2AppList = {
    L"PotPlayerMini64.exe",
    L"QyClient.exe",
    L"QyPlayer.exe",
    L"QiyiService.exe",
    L"QyFragment.exe",
    L"vlc.exe",
    L"SHPlayer.exe"
};

const std::vector<std::wstring> g_Ban3DAppList = {
    L"ONENOTE.EXE"
};

const std::vector<std::wstring> g_EnableAnimationAppList = {
    L"WINWORD.EXE"
};

static std::wstring GetCurrentProcessName()
{
    auto process = GetCurrentProcess();
    std::vector<wchar_t> processName(MAX_PATH);
    GetProcessImageFileNameW(process, processName.data(), MAX_PATH);
    std::wstring name = processName.data();
    auto preLocation = name.rfind(L"\\");
    if (preLocation == std::wstring::npos || preLocation == name.size() - 1) {
        return L"";
    }
    return name.substr(preLocation + 1);
}

static bool IsInAppList(const std::vector<std::wstring> &appList) {
    auto currentAppName = GetCurrentProcessName();
    for (auto& appName : appList) {
        if (currentAppName == appName) {
            return true;
        }
    }
    return false;
}

static bool IsInBand3DAppList() {
    auto currentAppName = GetCurrentProcessName();
    for (auto& appName : g_Ban3DAppList) {
        if (currentAppName == appName) {
            return true;
        }
    }
    return false;
}

